package com.clientes;

import com.eventos.ActivityCategoriasEventos;
import com.eventssmartphone.AplicacionEvents;
import com.eventssmartphone.R;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.Toast;

public class ActivityMenu extends Activity {
	
	//@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.cl_menu);
		
		//Cargar animaciones
		final Animation animMove = AnimationUtils.loadAnimation(this, R.drawable.animation_move);
		final Animation animAlpha = AnimationUtils.loadAnimation(this, R.drawable.animation_alpha);
		final Animation animScale = AnimationUtils.loadAnimation(this, R.drawable.animation_scale);
		final Animation animRotate = AnimationUtils.loadAnimation(this, R.drawable.animation_rotate);
		
		//Cargar botones
		Button btnEventos = (Button)findViewById(R.id.btnEventos);
		Button btnPuntosVenta = (Button)findViewById(R.id.btnPuntosVenta);
		Button btnAmbientes = (Button)findViewById(R.id.btnAmbientes);
		Button btnOtros = (Button)findViewById(R.id.btnOtros);
		btnEventos.getBackground().setAlpha(150);
		btnPuntosVenta.getBackground().setAlpha(150);
		btnAmbientes.getBackground().setAlpha(150);
		btnOtros.getBackground().setAlpha(150);
		
		//Asignar las animaciones a los botones
		btnEventos.setOnClickListener(new Button.OnClickListener(){
			  //@Override
			  public void onClick(View arg0) {
			   arg0.startAnimation(animAlpha);
			   onButtonClicked(arg0);
			  }
		});
		
		btnPuntosVenta.setOnClickListener(new Button.OnClickListener(){
			  //@Override
			  public void onClick(View arg0) {
			   arg0.startAnimation(animRotate);
			   onButtonClicked(arg0);
			  }
		});
		
		btnAmbientes.setOnClickListener(new Button.OnClickListener(){
			  //@Override
			  public void onClick(View arg0) {
			   arg0.startAnimation(animScale);
			   onButtonClicked(arg0);
			  }
		});
		
		btnOtros.setOnClickListener(new Button.OnClickListener(){
			  //@Override
			  public void onClick(View arg0) {
			   arg0.startAnimation(animMove);
			   onButtonClicked(arg0);
			  }
		});
    }
	
	public void onButtonClicked(View v) {
        // Envia a la siguiente actividad
		if (v.getId() == R.id.btnEventos){
			Intent intent = new Intent(this, ActivityCategoriasEventos.class);
			startActivity(intent);
		}
		else if (v.getId() == R.id.btnPuntosVenta){
			Intent intent = new Intent(this, ActivityListaProv.class);
			startActivity(intent);
		}
		else if (v.getId() == R.id.btnAmbientes){
			Intent intent = new Intent(this, ActivityListaAmbientes.class);
			startActivity(intent);
		}
		else if (v.getId() == R.id.btnOtros){
			Log.i("otros","otros");
			//Log.i("otros","otros");
			Intent intent = new Intent(this, ActivityListadoFavoritos.class);
			startActivity(intent);
		}
    
    }
	
}
